home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1998 November: Tool Chest / Dev.CD Nov 98 TC.toast / Sample Code / Snippets / Toolbox / Password / Resource / Sample.r < prev    next >
Encoding:
Text File  |  1996-09-17  |  9.6 KB  |  603 lines  |  [TEXT/CWIE]

  1. /*------------------------------------------------------------------------------
  2. #
  3. #    Apple Macintosh Developer Technical Support
  4. #
  5. #    MultiFinder-Aware Simple Sample Application
  6. #
  7. #    Sample
  8. #
  9. #    Sample.r    -    Rez Source
  10. #
  11. #    Copyright © 1989 Apple Computer, Inc.
  12. #    All rights reserved.
  13. #
  14. #    Versions:    
  15. #                1.00                08/88
  16. #                1.01                11/88
  17. #                1.02                04/89
  18. #                1.03                06/89
  19. #
  20. #    Components:
  21. #                Sample.p            June 1, 1989
  22. #                Sample.c            June 1, 1989
  23. #                Sample.a            June 1, 1989
  24. #                Sample.inc1.a        June 1, 1989
  25. #                SampleMisc.a        June 1, 1989
  26. #                Sample.r            June 1, 1989
  27. #                Sample.h            June 1, 1989
  28. #                PSample.make        June 1, 1989
  29. #                CSample.make        June 1, 1989
  30. #                ASample.make        June 1, 1989
  31. #
  32. #    Sample is an example application that demonstrates how to
  33. #    initialize the commonly used toolbox managers, operate 
  34. #    successfully under MultiFinder, handle desk accessories, 
  35. #    and create, grow, and zoom windows.
  36. #
  37. #    It does not by any means demonstrate all the techniques 
  38. #    you need for a large application. In particular, Sample 
  39. #    does not cover exception handling, multiple windows/documents, 
  40. #    sophisticated memory management, printing, or undo. All of 
  41. #    these are vital parts of a normal full-sized application.
  42. #
  43. #    This application is an example of the form of a Macintosh 
  44. #    application; it is NOT a template. It is NOT intended to be 
  45. #    used as a foundation for the next world-class, best-selling, 
  46. #    600K application. A stick figure drawing of the human body may 
  47. #    be a good example of the form for a painting, but that does not 
  48. #    mean it should be used as the basis for the next Mona Lisa.
  49. #
  50. #    We recommend that you review this program or TESample before 
  51. #    beginning a new application.
  52. ------------------------------------------------------------------------------*/
  53.  
  54.  
  55. #include "Types.r"
  56. #include "SysTypes.r"
  57.  
  58. #include "Sample.h"
  59.  
  60. /* we use an MBAR resource to conveniently load all the menus */
  61.  
  62. resource 'MBAR' (rMenuBar, preload) {
  63.     { mApple, mFile, mEdit, mPassword };    /* four menus */
  64. };
  65.  
  66.  
  67. resource 'MENU' (mApple, preload) {
  68.     mApple, textMenuProc,
  69.     AllItems & ~MenuItem2,    /* Disable dashed line, enable About and DAs */
  70.     enabled, apple,
  71.     {
  72.         "About Sample…",
  73.             noicon, nokey, nomark, plain;
  74.         "-",
  75.             noicon, nokey, nomark, plain
  76.     }
  77. };
  78.  
  79. resource 'MENU' (mFile, preload) {
  80.     mFile, textMenuProc,
  81.     MenuItem12,                /* enable Quit only, program enables others */
  82.     enabled, "File",
  83.     {
  84.         "New",
  85.             noicon, "N", nomark, plain;
  86.         "Open",
  87.             noicon, "O", nomark, plain;
  88.         "-",
  89.             noicon, nokey, nomark, plain;
  90.         "Close",
  91.             noicon, "W", nomark, plain;
  92.         "Save",
  93.             noicon, "S", nomark, plain;
  94.         "Save As…",
  95.             noicon, nokey, nomark, plain;
  96.         "Revert",
  97.             noicon, nokey, nomark, plain;
  98.         "-",
  99.             noicon, nokey, nomark, plain;
  100.         "Page Setup…",
  101.             noicon, nokey, nomark, plain;
  102.         "Print…",
  103.             noicon, nokey, nomark, plain;
  104.         "-",
  105.             noicon, nokey, nomark, plain;
  106.         "Quit",
  107.             noicon, "Q", nomark, plain
  108.     }
  109. };
  110.  
  111. resource 'MENU' (mEdit, preload) {
  112.     mEdit, textMenuProc,
  113.     NoItems,                /* disable everything, program does the enabling */
  114.     enabled, "Edit",
  115.      {
  116.         "Undo",
  117.             noicon, "Z", nomark, plain;
  118.         "-",
  119.             noicon, nokey, nomark, plain;
  120.         "Cut",
  121.             noicon, "X", nomark, plain;
  122.         "Copy",
  123.             noicon, "C", nomark, plain;
  124.         "Paste",
  125.             noicon, "V", nomark, plain;
  126.         "Clear",
  127.             noicon, nokey, nomark, plain
  128.     }
  129. };
  130.  
  131. resource 'MENU' (mPassword, preload) {
  132.     mPassword, textMenuProc,
  133.     NoItems,                /* disable everything, program does the enabling */
  134.     enabled, "Password",
  135.      {
  136.         "Two Item Password Dialog",
  137.             noicon, nokey, nomark, plain;
  138.         "Different Font Password Dialog",
  139.             noicon, nokey, nomark, plain;
  140.         "Internal Buffer Password Dialog",
  141.             noicon, nokey, nomark, plain
  142.     }
  143. };
  144.  
  145.  
  146. /* this ALRT and DITL are used as an About screen */
  147.  
  148. resource 'ALRT' (rAboutAlert, purgeable) {
  149.     {40, 20, 160, 290},
  150.     rAboutAlert,
  151.     { /* array: 4 elements */
  152.         /* [1] */
  153.         OK, visible, silent,
  154.         /* [2] */
  155.         OK, visible, silent,
  156.         /* [3] */
  157.         OK, visible, silent,
  158.         /* [4] */
  159.         OK, visible, silent
  160.     }
  161. };
  162.  
  163. resource 'DITL' (rAboutAlert, purgeable) {
  164.     { /* array DITLarray: 5 elements */
  165.         /* [1] */
  166.         {88, 180, 108, 260},
  167.         Button {
  168.             enabled,
  169.             "OK"
  170.         },
  171.         /* [2] */
  172.         {8, 8, 24, 214},
  173.         StaticText {
  174.             disabled,
  175.             "Simple Sample"
  176.         },
  177.         /* [3] */
  178.         {32, 8, 48, 237},
  179.         StaticText {
  180.             disabled,
  181.             "Copyright © 1989 Apple Computer"
  182.         },
  183.         /* [4] */
  184.         {56, 8, 72, 136},
  185.         StaticText {
  186.             disabled,
  187.             "Brought to you by:"
  188.         },
  189.         /* [5] */
  190.         {80, 24, 112, 167},
  191.         StaticText {
  192.             disabled,
  193.             "Macintosh Developer  Technical Support"
  194.         }
  195.     }
  196. };
  197.  
  198.  
  199. /* this ALRT and DITL are used as an error screen */
  200.  
  201. resource 'ALRT' (rUserAlert, purgeable) {
  202.     {40, 20, 120, 260},
  203.     rUserAlert,
  204.     { /* array: 4 elements */
  205.         /* [1] */
  206.         OK, visible, silent,
  207.         /* [2] */
  208.         OK, visible, silent,
  209.         /* [3] */
  210.         OK, visible, silent,
  211.         /* [4] */
  212.         OK, visible, silent
  213.     }
  214. };
  215.  
  216.  
  217. resource 'DITL' (rUserAlert, purgeable) {
  218.     { /* array DITLarray: 3 elements */
  219.         /* [1] */
  220.         {50, 150, 70, 230},
  221.         Button {
  222.             enabled,
  223.             "OK"
  224.         },
  225.         /* [2] */
  226.         {10, 60, 30, 230},
  227.         StaticText {
  228.             disabled,
  229.             "Sample - Error occurred!"
  230.         },
  231.         /* [3] */
  232.         {8, 8, 40, 40},
  233.         Icon {
  234.             disabled,
  235.             2
  236.         }
  237.     }
  238. };
  239.  
  240.  
  241. resource 'WIND' (rWindow, preload, purgeable) {
  242.     {60, 40, 290, 160},
  243.     noGrowDocProc, visible, noGoAway, 0x0, "Traffic"
  244. };
  245.  
  246.  
  247. /* here is the quintessential MultiFinder friendliness device, the SIZE resource */
  248.  
  249. resource 'SIZE' (-1) {
  250.     dontSaveScreen,
  251.     acceptSuspendResumeEvents,
  252.     enableOptionSwitch,
  253.     canBackground,                /* we can background; we don't currently, but our sleep value */
  254.                                 /* guarantees we don't hog the Mac while we are in the background */
  255.     multiFinderAware,            /* this says we do our own activate/deactivate; don't fake us out */
  256.     backgroundAndForeground,    /* this is definitely not a background-only application! */
  257.     dontGetFrontClicks,            /* change this is if you want "do first click" behavior like the Finder */
  258.     ignoreChildDiedEvents,        /* essentially, I'm not a debugger (sub-launching) */
  259.     not32BitCompatible,            /* this app should not be run in 32-bit address space */
  260.     reserved,
  261.     reserved,
  262.     reserved,
  263.     reserved,
  264.     reserved,
  265.     reserved,
  266.     reserved,
  267.     100000,
  268.     100000    
  269. };
  270.  
  271. resource 'DLOG' (200) {
  272.     {38, 16, 137, 255},
  273.     dBoxProc,
  274.     visible,
  275.     goAway,
  276.     0x0,
  277.     200,
  278.     ""
  279. };
  280.  
  281. resource 'DLOG' (300) {
  282.     {44, 28, 112, 223},
  283.     dBoxProc,
  284.     visible,
  285.     goAway,
  286.     0x0,
  287.     300,
  288.     ""
  289. };
  290.  
  291. resource 'DLOG' (201) {
  292.     {38, 16, 139, 256},
  293.     dBoxProc,
  294.     visible,
  295.     goAway,
  296.     0x0,
  297.     201,
  298.     ""
  299. };
  300.  
  301. resource 'DLOG' (202) {
  302.     {38, 17, 136, 256},
  303.     dBoxProc,
  304.     visible,
  305.     goAway,
  306.     0x0,
  307.     202,
  308.     ""
  309. };
  310.  
  311. resource 'DITL' (200) {
  312.     {    /* array DITLarray: 6 elements */
  313.         /* [1] */
  314.         {74, 175, 94, 233},
  315.         Button {
  316.             enabled,
  317.             "OK"
  318.         },
  319.         /* [2] */
  320.         {48, 33, 64, 216},
  321.         EditText {
  322.             enabled,
  323.             ""
  324.         },
  325.         /* [3] */
  326.         {103, 6, 119, 230},
  327.         EditText {
  328.             enabled,
  329.             ""
  330.         },
  331.         /* [4] */
  332.         {74, 5, 93, 171},
  333.         CheckBox {
  334.             enabled,
  335.             "Show Second TE Field"
  336.         },
  337.         /* [5] */
  338.         {25, 3, 41, 196},
  339.         StaticText {
  340.             disabled,
  341.             "Please enter your password:"
  342.         },
  343.         /* [6] */
  344.         {2, 32, 18, 208},
  345.         StaticText {
  346.             disabled,
  347.             "Two Item Password Dialog"
  348.         }
  349.     }
  350. };
  351.  
  352. resource 'DITL' (300) {
  353.     {    /* array DITLarray: 2 elements */
  354.         /* [1] */
  355.         {41, 127, 61, 185},
  356.         Button {
  357.             enabled,
  358.             "OK"
  359.         },
  360.         /* [2] */
  361.         {2, 4, 35, 191},
  362.         StaticText {
  363.             disabled,
  364.             "You entered the password: ^0"
  365.         }
  366.     }
  367. };
  368.  
  369. resource 'DITL' (201) {
  370.     {    /* array DITLarray: 4 elements */
  371.         /* [1] */
  372.         {74, 175, 94, 233},
  373.         Button {
  374.             enabled,
  375.             "OK"
  376.         },
  377.         /* [2] */
  378.         {50, 22, 66, 213},
  379.         EditText {
  380.             enabled,
  381.             ""
  382.         },
  383.         /* [3] */
  384.         {25, 3, 41, 196},
  385.         UserItem {
  386.             disabled
  387.         },
  388.         /* [4] */
  389.         {2, 13, 18, 228},
  390.         UserItem {
  391.             disabled
  392.         }
  393.     }
  394. };
  395.  
  396. resource 'DITL' (202) {
  397.     {    /* array DITLarray: 4 elements */
  398.         /* [1] */
  399.         {74, 175, 94, 233},
  400.         Button {
  401.             enabled,
  402.             "OK"
  403.         },
  404.         /* [2] */
  405.         {48, 33, 64, 216},
  406.         EditText {
  407.             enabled,
  408.             ""
  409.         },
  410.         /* [3] */
  411.         {25, 3, 41, 196},
  412.         StaticText {
  413.             disabled,
  414.             "Please enter your password:"
  415.         },
  416.         /* [4] */
  417.         {3, 14, 20, 227},
  418.         StaticText {
  419.             disabled,
  420.             "Internal Buffer Password Dialog"
  421.         }
  422.     }
  423. };
  424.  
  425. data 'FONT' (3200, ".Pwd") {
  426. };
  427.  
  428. resource 'FONT' (3212) {
  429.     doExpandFont,
  430.     proportionalFont,
  431.     blackFont,
  432.     notSynthetic,
  433.     nofctbRsrc,
  434.     oneBit,
  435.     noCharWidthTable,
  436.     noImageHeightTable,
  437.     32,
  438.     65,
  439.     9,
  440.     0,
  441.     -3,
  442.     11,
  443.     15,
  444.     12,
  445.     3,
  446.     0,
  447.     1,
  448.     $"0000 0000 0000 0000 1020 3870 7CFA FFFF"
  449.     $"7CFA 3870 1020 0000 0000 0000 0000",
  450.     {    /* array: 36 elements */
  451.         /* [1] */
  452.         0,
  453.         /* [2] */
  454.         0,
  455.         /* [3] */
  456.         0,
  457.         /* [4] */
  458.         0,
  459.         /* [5] */
  460.         0,
  461.         /* [6] */
  462.         0,
  463.         /* [7] */
  464.         0,
  465.         /* [8] */
  466.         0,
  467.         /* [9] */
  468.         0,
  469.         /* [10] */
  470.         0,
  471.         /* [11] */
  472.         0,
  473.         /* [12] */
  474.         0,
  475.         /* [13] */
  476.         0,
  477.         /* [14] */
  478.         0,
  479.         /* [15] */
  480.         0,
  481.         /* [16] */
  482.         0,
  483.         /* [17] */
  484.         0,
  485.         /* [18] */
  486.         0,
  487.         /* [19] */
  488.         0,
  489.         /* [20] */
  490.         0,
  491.         /* [21] */
  492.         0,
  493.         /* [22] */
  494.         0,
  495.         /* [23] */
  496.         0,
  497.         /* [24] */
  498.         0,
  499.         /* [25] */
  500.         0,
  501.         /* [26] */
  502.         0,
  503.         /* [27] */
  504.         0,
  505.         /* [28] */
  506.         0,
  507.         /* [29] */
  508.         0,
  509.         /* [30] */
  510.         0,
  511.         /* [31] */
  512.         0,
  513.         /* [32] */
  514.         0,
  515.         /* [33] */
  516.         0,
  517.         /* [34] */
  518.         0,
  519.         /* [35] */
  520.         7,
  521.         /* [36] */
  522.         14
  523.     },
  524.     {    /* array: 36 elements */
  525.         /* [1] */
  526.         1,
  527.         /* [2] */
  528.         -1,
  529.         /* [3] */
  530.         -1,
  531.         /* [4] */
  532.         -1,
  533.         /* [5] */
  534.         -1,
  535.         /* [6] */
  536.         -1,
  537.         /* [7] */
  538.         -1,
  539.         /* [8] */
  540.         -1,
  541.         /* [9] */
  542.         -1,
  543.         /* [10] */
  544.         -1,
  545.         /* [11] */
  546.         -1,
  547.         /* [12] */
  548.         -1,
  549.         /* [13] */
  550.         -1,
  551.         /* [14] */
  552.         -1,
  553.         /* [15] */
  554.         -1,
  555.         /* [16] */
  556.         -1,
  557.         /* [17] */
  558.         -1,
  559.         /* [18] */
  560.         -1,
  561.         /* [19] */
  562.         -1,
  563.         /* [20] */
  564.         -1,
  565.         /* [21] */
  566.         -1,
  567.         /* [22] */
  568.         -1,
  569.         /* [23] */
  570.         -1,
  571.         /* [24] */
  572.         -1,
  573.         /* [25] */
  574.         -1,
  575.         /* [26] */
  576.         -1,
  577.         /* [27] */
  578.         -1,
  579.         /* [28] */
  580.         -1,
  581.         /* [29] */
  582.         -1,
  583.         /* [30] */
  584.         -1,
  585.         /* [31] */
  586.         -1,
  587.         /* [32] */
  588.         -1,
  589.         /* [33] */
  590.         -1,
  591.         /* [34] */
  592.         9,
  593.         /* [35] */
  594.         9,
  595.         /* [36] */
  596.         0
  597.     },
  598.     {    /* array: 0 elements */
  599.     },
  600.     {    /* array: 0 elements */
  601.     }
  602. };
  603.